#ifndef _PARTHUS_UT_ATS_TRACE_H
#define _PARTHUS_UT_ATS_TRACE_H

/*************************************************************************
 * MODULE NAME:    ut_ats_trace.h
 * PROJECT CODE:    BlueStream
 * DESCRIPTION:    Lower Tester Functions for the abstract test suite
 * MAINTAINER:     Daire McNamara
 * DATE:           23 Aug 2001
 *
 * SOURCE CONTROL: $Id: ut_ats_trace.h,v 1.1 2008/02/03 09:39:25 james Exp $
 *
 * LICENSE:
 *     This source code is copyright (c) 2001-2004 Ceva Inc.
 *     All rights reserved.
 *
 * REVISION HISTORY:
 *    V1.0     23 Aug 2001 -   jn     - Initial Version
 *
 * SOURCE: Expose interface for ut_ats_lower_trace.c, ut_ats_upper_trace.c
 * ISSUES:
 *
 *************************************************************************/

void UTtrace_Initialise(void);
/*
 * PDU is Hex %02x format separated by spaces
 */
void UTtrace_Record_Raw_PDU(const u_int8 * pdu, u_int32 pdu_len);

/*
 * PDU is displayed as  prefix: [0x22 0x33 ...]
 */
void UTtrace_Record_PDU(const char *prefix, const u_int8 * pdu, u_int32 pdu_len);

void UTtrace_Record_LMP_Packet(const u_int8 *pdu, u_int8 pdu_len, u_int32 msg_dir);
void UTtrace_Record_LC_Packet (const u_int8 *pdu, u_int8 pdu_len, u_int32 msg_dir);
void UTtrace_Record_BB_Packet (const u_int8 *pdu, u_int8 pdu_len, u_int32 msg_dir);

void UTtrace_Record_LMP_Packet_Extended(u_int32 bt_clk, u_int8 seqn, 
							   const u_int8 *pdu, u_int8 pdu_len, u_int32 msg_dir);
void UTtrace_Record_LC_Packet_Extended(u_int32 bt_clk, u_int8 lmp_seqn, 
							   const u_int8 *pdu, u_int8 pdu_len, u_int32 msg_dir);
void UTtrace_Record_BB_Packet_Extended(u_int32 bt_clk, u_int8 lmp_seqn, 
							   const u_int8 *pdu, u_int8 pdu_len, u_int32 msg_dir);
void UTtrace_Record_Radio_Event(u_int32 bt_clk, u_int8 lmp_seqn, 
							   const u_int8 *pdu, u_int8 pdu_len, u_int32 msg_dir);
void UTtrace_Record_Interrupt_Event(u_int32 bt_clk, u_int8 lmp_seqn, 
							   const u_int8 *pdu, u_int8 pdu_len, u_int32 msg_dir);

/*
 * msg_dir 
 */
#define TRACE_SENT            1
#define TRACE_RECEIVED        2
#define TRACE_EXPECTED        3
#define TRACE_FORCE        0x80
#define TRACE_LINE_FORMAT 0x100

void UTtrace_Record_HCI_Command(const u_int8 *pdu, u_int32 pdu_len, u_int32 msg_dir);
void UTtrace_Record_HCI_ACL_Data_Packet(u_int16 handle,
      u_int8 pb_flag, u_int8 bc_flag, const u_int8* data_buf, u_int32 data_len,
      u_int32 msg_dir);
void UTtrace_Record_HCI_SCO_Data_Packet(u_int16 handle,
      const u_int8* data_buf, u_int32 data_len, u_int32 msg_dir);

void UTtrace_Record_HCI_Event(const u_int8 *pdu, u_int32 pdu_len, u_int32 msg_dir);
const char *UTtrace_Lookup_LMP_Opcode(const u_int8 op_code, const u_int8 ext_op_code);
const char *UTtrace_Lookup_HCI_Event_Opcode(u_int8 event_op_code);
const char *UTtrace_Lookup_HCI_Command_Opcode(u_int16 command_op_code);
const char *UTtrace_Lookup_Error_Code(const u_int8 error_code);
const char *UTtrace_Lookup_JAL_Interrupt(const u_int32 jal_irq_mask);

#include "lmp_acl_connection.h"
const char *UTtrace_Lookup_Function_Name(void (*fn_address)(t_lmp_link*));

void UTtrace_Mark_Log(const char *prefix, const char *file, int line);
#define UTtrace_Mark()          UTtrace_Mark_Log("Mark:", __FILE__, __LINE__)

#endif
